package com.example.canteen.controller;
import com.example.canteen.domain.Inventory;
import com.example.canteen.domain.InventoryAdjustments;
import com.example.canteen.service.InventoryAdjustmentsService;
import com.example.canteen.service.InventoryService;
import com.example.canteen.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController

@RequestMapping("/inventoryadjustments")
@Api(tags = "餐厅库存调整管理(0304 高凯)")
//@Anonymous
public class InventoryAdjustmentsController {
    @Autowired
    InventoryAdjustmentsService service;
    @GetMapping("/getInventoryAdjustmentsListAll")
    @ApiOperation(value = "获取所有库存调整列表")
    public AjaxResult getInventoryAdjustmentsListAll() {
        System.out.println(service.selectAllInventoryAdjustments());
        return AjaxResult.success(service.selectAllInventoryAdjustments());
    };
    @GetMapping("/getInventoryAdjustmentsById")
    @ApiOperation(value = "根据id查询库存调整信息")
    public AjaxResult getInventoryAdjustmentsById(int id) {
        System.out.println(service.selectInventoryAdjustmentsById(id));
        return AjaxResult.success(service.selectInventoryAdjustmentsById(id));
    }
    @PostMapping("/insertInventoryAdjustments")
    @ApiOperation(value = "增加库存调整")
    public AjaxResult addInventory(@RequestBody InventoryAdjustments inventoryadjustments) {
        return AjaxResult.success(service.insertInventoryAdjustments(inventoryadjustments));
    }
    @PutMapping("/UpdateInventoryAdjustments")
    @ApiOperation(value = "修改库存数量")
    public AjaxResult UpdateInventoryAdjustments(@RequestBody InventoryAdjustments inventoryadjustments){
        return AjaxResult.success(service.updateInventoryAdjustments(inventoryadjustments));
    }

}
